#define _GNU_SOURCE
#include <pthread.h>
#include "log.h"
#include <unistd.h>

void *thread_func01(void *arg)
{
	while (1)
	{
		log_info("thread_func01:%d \n", gettid());
		sleep(1);
	}
}

void *thread_func02(void *arg)
{	int i=0;
	while (i<15)
	{	i++;
		log_info("thread_func02:%d \n", gettid());
		sleep(1);
	}
	return NULL;
}

int main(int argc, char const *argv[])
{

	pthread_t thread_id01, thread_id02;

	pthread_create(&thread_id01, NULL, thread_func01, NULL);
	pthread_create(&thread_id02, NULL, thread_func02, NULL);

	sleep(10);
	pthread_cancel(thread_id01);
	pthread_join(thread_id02, NULL);
	log_info("all thread exit");
	return 0;
}
